$(function(){
	//提交事件
	$('#submitBtn').click(function(){
		var $p = $('#sysUserPassword');
		var $f = $('#confirmPassword');
		
		if($p.val() == ''){
			jAlert('密码必须填写');
			return;
		}else if(!Validator.password($p.val())){
			jAlert('密码,以字母或数据开头，6-20位');
			return;
		}
		
		if($f.val() == ''){
			jAlert('确认密码必填');
			return;
		}else if(!Validator.password($f.val())){
			jAlert('确认密码,以字母或数字开头，6-20位');
			return;
		}
		
		if($p.val() != $f.val()){
			jAlert('密码与确认密码不一致');
			return;
		}
		
		$p.val($.md5($p.val()));
		$f.val($.md5($f.val()));
		
		function collectData(){
			var a = new Array();
			a.push('sysUser.password=' + $p.val());
			return a.join('&');
		}
		
		$.ajax({
			type:'POST',
			url: 'sysUserAction!updateUserPassword.ac',
			data: collectData(),
			dataType:'json',
			beforeSend:function(){
				jLoading("正在操作，请稍后...");
			},
			success:function(rs){
				if(rs.flag){
					jAlert('操作成功');
				}else{
					jAlert('操作失败:' + rs.msg);
				}
			}
		});
	});
});